﻿@using System.Text
@using OA.Model
@using OA.AspNetCore.Html
@using OA.Core
@using OA.Core.Model
@using OA.Core.Helper


@model List<OA.Model.VoteItem>
@{
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
    OA.Model.Vote infoVote = ViewBag.Vote;
}
<style type="text/css">
    .VoteTitle {
        width: 100%;
        text-align: center;
        font-size: 32px;
    }

    .VoteTime {
        margin-top: 10px;
        width: 100%;
        text-align: center;
        font-size: 14px;
        color: red;
    }

    .Items {
        margin-top: 60px;
    }
</style>

<div class="layui-tab layui-tab-brief" lay-filter="user">
    @using (Html.BeginForm(FormMethod.Post, htmlAttributes: new { @class = "layui-form", id = "myForm" }))
    {
        Type t = typeof(VoteItemType);
        char[] chars = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' };
        <p class="VoteTitle">@infoVote.Title</p>
        <p class="VoteTime">@infoVote.StartTime--@infoVote.EndTime</p>
        <div class="Items">
            @for (int i = 0; i < Model.Count; i++)
            {
                int temp = i + 1;
                VoteItem item = Model[i];
                List<string> items = new List<string>();
                if (!string.IsNullOrWhiteSpace(item.ItemContent))
                {
                    items = item.ItemContent.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
                }
                string titleIndex = $"第{temp}题";
                <div style="margin:30px;">
                    <input type="hidden" name="Item[@i].VoteItemID" value="@item.ID" />
                    <p><span style="padding-right:6px;">[@MyEnum.GetEnumNameByValue(item.Type, t)]</span>@titleIndex：@item.Title</p>
                    @if (item.Type == 1)
                    {
                        <p>
                            @for (int j = 0; j < items.Count; j++)
                            {
                                <input type="radio" name="Item[@i].MyOptions" value="j" title="@chars[j]：@items[j]">
                            }
                        </p>
                    }
                    else if (item.Type == 2)
                    {
                        <p style="padding-top:20px;">
                            @for (int j = 0; j < items.Count; j++)
                            {
                                <input type="checkbox" lay-skin="primary" name="Item[@i].MyOptions" value="j" title="@chars[j]:@items[j]">
                            }
                        </p>
                    }
                    else if (item.Type == 3)
                    {
                        <p style="padding-top:20px;">
                            <textarea placeholder="请输入内容" class="layui-textarea" name="Item[@i].MyOptions"></textarea>
                        </p>
                    }
                </div>

            }
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block" style="text-align:right;margin-right:30px;">
                <input type="submit" value="提 交" class="layui-btn mySubmit" />
            </div>
        </div>
    }
</div>
 